const baseURL = '/ilink/client/'
// 分平台默认标识；真实标识存储在VUEX中
function getPlatFormCodeByUrl () {
  let realUrl = window.location.href
  if (window.location.port) {
    let errorUrlIndex = window.location.href.indexOf(';jsessionid')
    if (errorUrlIndex > -1) {
      realUrl = window.location.href.substring(0, errorUrlIndex)
    }
  }
  let _platformCode = GetQueryString('loginId')
  if (!_platformCode) {
    _platformCode = PLATCOEDEFAULT
    if (realUrl.indexOf('//fire.') > -1) {
      _platformCode = realUrl.split('//fire.')[1].split('.')[0]
    }
    if (realUrl.indexOf('//unit.') > -1) {
      _platformCode = realUrl.split('//unit.')[1].split('.')[0]
    }
  }
  return _platformCode
}
function GetQueryString (name) {
  var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)')
  var r = window.location.search.substr(1).match(reg)
  if (r != null) return unescape(r[2]); return null
}

// 默认图片
const defaultImg = 'resource/rdspFile_1553739347335.png'
const defultLogo = 'resource/rdspFile_1553739371033.png'
const defaulLearn = 'resource/emptyStudyImg.png'
export default {
  baseURL,
  getPlatFormCodeByUrl,
  defaultImg,
  defultLogo,
  defaulLearn
}
